
#ifndef VAR_HPP
#define VAR_HPP

#include "Matrix.hpp"
#include "Normal.hpp"

using namespace std;

class VAR {
  int m_order, m_dim;
  // coefficient matrices
  vector < Matrix<double> > m_A;
  // constant vector
  Vector<double> m_C;
  // impulse sigma
  Vector<double> m_S;
  // history
  Matrix<double> m_Y;
  // result of simulate
  Vector<double> m_Yt;
  // disturbance
  Vector<double> m_E;
  //
  // RNG
  //
  Normal* RN;
public:
  VAR ( int p_order, int p_dim );
  VAR ( int p_order, int p_dim, const vector< Matrix<double> >& p_A, 
	const Vector<double>& p_C );
  virtual ~VAR();
  
  void Sigma(const Vector<double>& p_S);
  void Yi(const Vector<double>& p_Yi,int i);
  const Vector<double>& Yi(int i);
  void Ai(const Matrix<double>& p_Ai,int i);
  const Matrix<double>& Ai(int i) const;
  void C ( const Vector<double>& p_C );
  const Vector<double>& C() const { return m_C; }
  const Vector<double>& E() const { return m_E; }
  // Yt - step forward
  const Vector<double>& simulate ();
};

#endif
